﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MatchDisp.Util
{
    public static class FormsUtil
    {
        public enum DialogType
        {
            OpenDialog,
            SaveDialog
        }

        public static string GetFilePathFromOpenFileDialog(string filter, DialogType dialogType)
        {
            FileDialog fileDialog;
            if (dialogType == DialogType.OpenDialog)
                fileDialog = new OpenFileDialog {RestoreDirectory = true, Filter = filter};
            else
                fileDialog = new SaveFileDialog {RestoreDirectory = true, Filter = filter};
            return fileDialog.ShowDialog() == DialogResult.OK ? fileDialog.FileName : null;
        }
    }
}
